package com.mall.api.order;

import com.mall.api.order.dto.OrderDTO;
import com.mall.api.order.fallback.OrderFeignFallback;
import com.mall.common.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(name = "mall-order", path = "/order", fallback = OrderFeignFallback.class)
public interface OrderFeignClient {

    @PostMapping("/create")
    Result<OrderDTO> createOrder(@RequestBody OrderDTO orderDTO);

    @GetMapping("/{id}")
    Result<OrderDTO> getOrderById(@PathVariable("id") Long id);

    @GetMapping("/user/{userId}")
    Result<OrderDTO> getOrderByUserId(@PathVariable("userId") Long userId);

    @PutMapping("/status/{id}/{status}")
    Result<Void> updateOrderStatus(@PathVariable("id") Long id, @PathVariable("status") Integer status);

    @DeleteMapping("/{id}")
    Result<Void> deleteOrder(@PathVariable("id") Long id);
} 